package com.hongpu.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hongpu.domain.HpProjectWorkPay;
import com.hongpu.dto.ExpensesDto;
import com.hongpu.dto.ProjectWorkPayDto1;
import com.hongpu.vo.HpProjectWorkPayVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;

/**
* @author Michael zhang
* @description 针对表【hp_project_work_pay(项目的回款与支出)】的数据库操作Mapper
* @createDate 2025-04-25 21:03:15
* @Entity generator.domain.HpProjectWorkPay
*/
@Mapper
public interface HpProjectWorkPayMapper extends BaseMapper<HpProjectWorkPay> {
    /**
     * 分页查询
     * @param page
     * @param state
     * @return
     */
    IPage<HpProjectWorkPayVo> selectPage(@Param("ipage") IPage<?> ipage, @Param("projectName") String projectName);
    IPage<HpProjectWorkPayVo> page(@Param("ipage") IPage<?> ipage, @Param("projectName") String projectName);
    List<HpProjectWorkPayVo> list(@Param("projectName") String projectName);



    /**
     * 根据数据ID修改合同总金额,在原字段值的基础上累加
     * @param totalContractAmount
     * @param id
     * @return
     */
    public boolean updateTotalContractAmount(@Param("totalContractAmount") BigDecimal totalContractAmount,@Param("id") Long id);
    /**
     * 当在明细中修改明细数据时， 根据数据ID修改重置合同总金额
     * @param totalContractAmount
     * @param id
     * @return
     */
    public boolean updateTotalContractAmount2(@Param("totalContractAmount") BigDecimal totalContractAmount,@Param("id") Long id);

    /**
     * 根据项目名查询所有项目的支出总额
     */
    public ExpensesDto getExpensesDtoByProjectName(@Param("projectName") String projectName);

    public HpProjectWorkPay getHpProjectWorkPay(Long projectId,String incomeAndExpenditureTypes);

    public boolean deleteByProjectId(Long projectId);

    /**
     * 根据项目名称查询收入和支出的项目ID
     */
    public List<ProjectWorkPayDto1> selectIdByProjectName(@Param("projectName") String projectName);

    /**
     * 根据 payListId 查询pay表中是收入还是支出
     */
    public String  getIncomeAndExpenditureTypes(Long payListId);

    /**
     * 根据项目ID修改项目名称
     */
    public boolean updateProjectName(@Param("projectId") Long projectId,@Param("projectName") String projectName,@Param("projectAmount") BigDecimal projectAmount);
}




